import 'package:json_annotation/json_annotation.dart';
import 'package:juming_test/model/domain/domain_filter_item_model.dart';

part 'domain_filter_section_model.g.dart';

@JsonSerializable(explicitToJson: true, includeIfNull: false)
class DomainFilterSectionModel {
  DomainFilterSectionModel(
    this.id,
    this.title,
    this.key,
    this.children,
    this.hasCondition,
  );

  @JsonKey(defaultValue: 0)
  int id;
  // 标题
  @JsonKey(defaultValue: '')
  String title;
  // key
  @JsonKey(defaultValue: '')
  String key;
  // 子模块
  @JsonKey(defaultValue: [])
  List<DomainFilterItemModel> children;
  // 该模块下是否存在筛选条件（显示红点）
  @JsonKey(defaultValue: false)
  bool hasCondition;

  factory DomainFilterSectionModel.fromJson(Map<String, dynamic> json) =>
      _$DomainFilterSectionModelFromJson(json);
  Map<String, dynamic> toJson() => _$DomainFilterSectionModelToJson(this);
}
